//app.js
const {
  islogin
} = require('/api/base')
App({
  onLaunch: function () {
    // 登录
    wx.login({
      success: resp => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
        islogin({code:resp.code}).then(res=>{
          if(res.code == "0"){
            this.userInfo=res.data
            this.isLogin=true
            if (this.userInfoReadyCallback) {
              this.userInfoReadyCallback(res)
            }
          } else {
            wx.navigateTo({
              url: '/pages/login/index'
            })
          }
        })
      }
    })
  },
  userInfo: null,
  isLogin: false, // 是否登录
  showTask: "2"
})